﻿using System.IO;
using System.IO.IsolatedStorage;

namespace ImageProcessing.Storage
{
    public class WP7PersistanceDB : PersistanceDB
    {
        private readonly IsolatedStorageFile _fileStorage = IsolatedStorageFile.GetUserStoreForApplication();
        
        protected override void DeleteFile(string fileName)
        {
            _fileStorage.DeleteFile(fileName);
        }

        protected override Stream FileStream(string fileName, FileMode fileMode, FileAccess fileAccess)
        {
            return _fileStorage.OpenFile(fileName, fileMode, fileAccess);
        }

        public override string[] GetAllPointsFiles()
        {
            return _fileStorage.GetFileNames("*" + PointsFileExtension);
        }
    }
}
